// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObject;
// import com.alibaba.druid.sql.dialect.oracle.ast.OracleSegmentAttributesImpl;
// import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "OracleLobStorageClause.h"
#include "../../../../ast/SQLExpr.h"
#include "../../../../ast/SQLName.h"
#include "../../visitor/OracleASTVisitor.h"
#include "../../../../visitor/SQLASTVisitor.h"
#include "../../../../../utils/listTran.h"
#include "OracleStorageClause.h"

OracleLobStorageClause::OracleLobStorageClause()
{
  items = std::make_shared<std::list<SQLName_ptr>>();
}
void OracleLobStorageClause::accept0(SQLASTVisitor_ptr visitor)
{
  this->accept0(std::dynamic_pointer_cast<OracleASTVisitor>(visitor));
}

// @Override
void OracleLobStorageClause::accept0(OracleASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(OracleLobStorageClause)))
  {
    acceptChild(visitor, segementName);
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLName, SQLObject>(items);
    acceptChild(visitor, tmp1);
    acceptChild(visitor, tablespace);
  }
  visitor->endVisit(SharedObject(OracleLobStorageClause));
}

void OracleLobStorageClause::cloneTo(OracleLobStorageClause_ptr x)
{
  OracleSegmentAttributesImpl::cloneTo(x);

  if (segementName != nullptr)
  {
    x->setSegementName(std::dynamic_pointer_cast<SQLName>(segementName->clone()));
  }

  for (SQLName_ptr item : *items)
  {
    SQLName_ptr item2 = std::dynamic_pointer_cast<SQLName>(item->clone());
    item2->setParent(x);
    x->items->push_back(item2);
  }

  x->secureFile = secureFile;
  x->basicFile = basicFile;
  x->enable = enable;

  if (chunk != nullptr)
  {
    x->setChunk(std::dynamic_pointer_cast<SQLExpr>(chunk->clone()));
  }

  x->cache = cache;
  x->logging = logging;
  x->compress = compress;
  x->keepDuplicate = keepDuplicate;
  x->retention = retention;

  if (storageClause != nullptr)
  {
    x->setStorageClause(std::dynamic_pointer_cast<OracleStorageClause>(storageClause->clone()));
  }

  if (pctversion != nullptr)
  {
    x->setPctversion(std::dynamic_pointer_cast<SQLExpr>(pctversion->clone()));
  }
}

SQLObject_ptr OracleLobStorageClause::clone()
{
  SQLObject_ptr clone_tmp = std::shared_ptr<OracleLobStorageClause>(new OracleLobStorageClause());
  std::shared_ptr<OracleLobStorageClause> x = std::dynamic_pointer_cast<OracleLobStorageClause>(clone_tmp);
  // OracleLobStorageClause x = new OracleLobStorageClause();
  cloneTo(x);
  return x;
}

BOOL_ptr OracleLobStorageClause::getEnable()
{
  return enable;
}

void OracleLobStorageClause::setEnable(BOOL_ptr enable)
{
  this->enable = enable;
}

SQLExpr_ptr OracleLobStorageClause::getChunk()
{
  return chunk;
}

void OracleLobStorageClause::setChunk(SQLExpr_ptr chunk)
{
  this->chunk = chunk;
}

SQLName_list_ptr OracleLobStorageClause::getItems()
{
  return items;
}

BOOL_ptr OracleLobStorageClause::isSecureFile()
{
  return secureFile;
}

void OracleLobStorageClause::setSecureFile(BOOL_ptr secureFile)
{
  this->secureFile = secureFile;
}

BOOL_ptr OracleLobStorageClause::isBasicFile()
{
  return basicFile;
}

void OracleLobStorageClause::setBasicFile(BOOL_ptr basicFile)
{
  this->basicFile = basicFile;
}

BOOL_ptr OracleLobStorageClause::getCache()
{
  return cache;
}

void OracleLobStorageClause::setCache(BOOL_ptr cache)
{
  this->cache = cache;
}

BOOL_ptr OracleLobStorageClause::getLogging()
{
  return logging;
}

void OracleLobStorageClause::setLogging(BOOL_ptr logging)
{
  this->logging = logging;
}

BOOL_ptr OracleLobStorageClause::getCompress()
{
  return compress;
}

void OracleLobStorageClause::setCompress(BOOL_ptr compress)
{
  this->compress = compress;
}

BOOL_ptr OracleLobStorageClause::getKeepDuplicate()
{
  return keepDuplicate;
}

void OracleLobStorageClause::setKeepDuplicate(BOOL_ptr keepDuplicate)
{
  this->keepDuplicate = keepDuplicate;
}

BOOL_ptr OracleLobStorageClause::isRetention()
{
  return retention;
}

void OracleLobStorageClause::setRetention(BOOL_ptr retention)
{
  this->retention = retention;
}

OracleStorageClause_ptr OracleLobStorageClause::getStorageClause()
{
  return storageClause;
}

void OracleLobStorageClause::setStorageClause(OracleStorageClause_ptr storageClause)
{
  if (storageClause != nullptr)
  {
    storageClause->setParent(SharedObject(OracleLobStorageClause));
  }
  this->storageClause = storageClause;
}

SQLExpr_ptr OracleLobStorageClause::getPctversion()
{
  return pctversion;
}

void OracleLobStorageClause::setPctversion(SQLExpr_ptr pctversion)
{
  if (pctversion != nullptr)
  {
    pctversion->setParent(SharedObject(OracleLobStorageClause));
  }
  this->pctversion = pctversion;
}

SQLName_ptr OracleLobStorageClause::getSegementName()
{
  return segementName;
}

void OracleLobStorageClause::setSegementName(SQLName_ptr segementName)
{
  this->segementName = segementName;
}
